package cn.net.autocode.platform.function;

import cn.net.autocode.core.bean.ResultT;
import cn.net.autocode.dbManager.Dao;
import com.alibaba.fastjson2.JSONArray;
import com.alibaba.fastjson2.JSONObject;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController("platformFuncVersions")
@RequestMapping("/platform/funcVersions")
public class FuncVersions {

    private final Dao dictDao;

    public FuncVersions(@Qualifier("dictDao") Dao dictDao) {
        this.dictDao = dictDao;
    }


    @RequestMapping("load")
    public ResultT load(@RequestBody JSONObject param){
        JSONArray array = dictDao.queryJSONArray("select page_id,release_time,release_user,update_time,update_user,version from ac_page_versions where page_id=? order by version desc",param.getString("pageId"));
        return ResultT.success(array);
    }
}
